package br.com.rookgraph;

import org.junit.Assert;

import br.com.rookgraph.branchreduce.BranchReduce;
import br.com.rookgraph.heuristica.Heuristica;

public class BranchReduceTestProcedure {

	private Graph graph;
	private Graph tree;
	private Graph treeExpected;

	public BranchReduceTestProcedure(String graph, String tree, String treeExpected){
		this.graph = LoadGraph.file(graph);
		this.tree = LoadGraph.file(tree);
		this.treeExpected = LoadGraph.file(treeExpected);
	}

	public void test(Heuristica heuristica){
		Graph result = new BranchReduce(graph,tree, heuristica).execute();
		for (int i = 1; i <= result.getOrder(); i++) {
			String message = "Inconsistencia no vertice "+i+", adjacentes não esperados";
			Assert.assertArrayEquals(message ,treeExpected.getAdjacentes(i), result.getAdjacentes(i));
		}

	}






}
